package cn.neuq.myapplication;

import android.content.Context;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;

//https://github.com/StarDxxx/SqliteDemo/blob/42eb2efc525033986290abccd342b686ab762022/app/src/main/java/com/example/donxing/sqlitetest/MainActivity.java#L13
public class MyDBHelper extends SQLiteOpenHelper {
    //数据库版本
    public static final int DATABASE_VERSION = 1;
    //数据库名字
    public static final String DATABASE_NAME = "my.db";

    public MyDBHelper(Context context){
        //重构函數
        super(context, DATABASE_NAME, null, DATABASE_VERSION);

    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        //生成数据库表
        String createSQL=    "CREATE TABLE " + "my_table" + " (" +
                "id" + " INTEGER PRIMARY KEY, " +
                "name" + " TEXT" +
                " )";
        db.execSQL(createSQL);
    }

    @Override
    public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
        // TODO Auto-generated method stub

    }

}
